#ifndef UIFILE_H
#define UIFILE_H

#include <QGroupBox>
#include <QMenu>
#include "editor.h"
#include "table.h"
#include <uiattribute.h>
#include <filesystem.h>

class MainWindow;

namespace Ui {
class UIfile;
}

class UIfile : public QGroupBox
{
    Q_OBJECT

public:
    explicit UIfile(QWidget *parent = nullptr, File* file = nullptr);
    ~UIfile();

public:
    bool isdirectory=false;
    bool readOnly=false;
    void switchToDir();
    void editName();
    void open();
    void dele();
    void rename();
    void showUiattribute();
    void setTitle(QString);
    void setContent(QString);
    void setSize(int );
    void setReadOnly();
    void moveFile();
    void editType();
    File* getFilePtr() {
        return file_;
    }

protected:
    void mouseDoubleClickEvent(QMouseEvent*);
    void mousePressEvent(QMouseEvent*);

private:
    QMenu *m_contextMenu;
    QAction *m_openAction;
    QAction *m_delAction;
    QAction *m_readOnly;
    QAction *m_moveAction;
    QAction *m_uiattribute;
    QAction *m_renameAction;
    QAction *m_editType;
    QString content;
    QString title;
    QString name;
    Ui::UIfile *ui;
    editor e;
    table t;
    UIattribute a;
    File* file_;
    MainWindow* m_parent;
};

#endif // FILE_H
